//
//  UILabel+Extend.h
//  RMMaterialRed
//
//  Created by XBWH on 2024/3/6.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@protocol RBAttributeTapActionDelegate <NSObject>
@optional
- (void)rb_tapAttributeInLabel:(UILabel *)label
                        string:(NSString *)string
                         range:(NSRange)range
                        index:(NSInteger)index;
@end

@interface UILabel (Extend)
#pragma mark - UILabel点击事件
///是否打开点击效果，默认是打开
@property (nonatomic, assign) BOOL enabledTapEffect;
/// 点击高亮色
@property (nonatomic, strong) UIColor * tapHighlightedColor;
///是否扩大点击范围，默认是打开
@property (nonatomic, assign) BOOL enlargeTapArea;

- (void)rb_addAttributeTapActionWithStrings:(NSArray <NSString *> *)strings
                                 tapClicked:(void (^) (UILabel * label, NSString *string, NSRange range, NSInteger index))tapClick;
- (void)rb_addAttributeTapActionWithStrings:(NSArray <NSString *> *)strings
                                   delegate:(id <RBAttributeTapActionDelegate> )delegate;
- (void)rb_addAttributeTapActionWithRanges:(NSArray <NSString *> *)ranges
                                 tapClicked:(void (^) (UILabel * label, NSString *string, NSRange range, NSInteger index))tapClick;
- (void)rb_addAttributeTapActionWithRanges:(NSArray <NSString *> *)ranges
                                   delegate:(id <RBAttributeTapActionDelegate> )delegate;
- (void)rb_removeAttributeTapActions;

#pragma mark - 富文本
+(NSAttributedString *)rb_attributedTexts:(NSArray *)texts textColors:(NSArray *)textColors textFonts:(NSArray *)textFonts;
+(NSAttributedString *)rb_attributedTexts:(NSArray *)texts textColors:(NSArray *)textColors textFonts:(NSArray *)textFonts lineSpacing:(CGFloat)lineSpacing;
///给Label中划线
-(void)rb_labelTextWithStrikethrough:(NSString *)text;
///去除Label中划线
-(void)rb_labelTextWithUnderlineStyleNone:(NSString *)text;
/// 设置文本,并指定行间距
-(void)rb_labelText:(NSString *)text lineSpacing:(CGFloat)lineSpacing;

#pragma mark - 快速创建UILabel
+ (instancetype)rb_labelWithTitle:(NSString *)title color:(UIColor *)color font:(UIFont *)font alignment:(NSTextAlignment)alignment;

@end

NS_ASSUME_NONNULL_END
